﻿<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="true" CodeBehind="msgbody.aspx.cs" Inherits="ZX.WebApp.Message.msgbody" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../Styles/base.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../Scripts/CombinButton.js" type="text/javascript"></script>
    <link href="../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <script src="../Scripts/extend.validate.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
    <link href="../Styles/extendTable.css" rel="stylesheet" type="text/css" />
    <link href="cssjs/message.css" rel="stylesheet" type="text/css" />
     <style type="text/css">
         .tabck
         {
              width:100%;
         }
        .tableContent
        {
            font-size:12px;
        }
        .tableContent th
        {
            border: solid 1px #D4DBE2;
            font-weight: bold;
            background-color: #F2F8FF;
            white-space: nowrap;
            line-height: 28px;
            text-align: left; padding-left:3px;
        }
        .tableContent td
        {
            border: solid 1px #D4DBE2;
            background-color: #F2F8FF;
            line-height: 28px;
            text-align: left;
            padding-left:3px;
        }
        .textbox
        {
            border-bottom: black 1px solid;
            border-top-style: none;
            border-right-style: none;
            border-left-style: none;
            background-color: white;
            overflow:hidden;
            height: 100%;
            width:98%; 
        }
         .style6
        {
           border-bottom: black 1px solid;
           border-top-style: none;
           border-right-style: none;
           border-left-style: none;
           background-color: white;
           overflow:hidden;
           height: 100%;
           width: 98%;
        }
        .labmessage
        {
            color:Red; 
        }
    </style>
</head>
<body  class="yui-skin-sam">
    <form id="form1" class="formBuilderForm" runat="server">
  
    <table class="tableContent">
            <tr>
                <td width="100">选择对象：</td>
                <td>
                    <asp:DropDownList ID="selectOption" runat="server" AppendDataBoundItems="true" Width="160">
                        <asp:ListItem Value="2">群组</asp:ListItem>
                        <asp:ListItem Value="3">群组成员</asp:ListItem>
                        <asp:ListItem Value="0">组织架构</asp:ListItem>
                        <asp:ListItem Value="1">客户1</asp:ListItem>
                        <asp:ListItem Value="4">NDFVX类</asp:ListItem>
                    </asp:DropDownList>
               <button id="btnPM" name="mes"  class="btnCheck"  type="button" 
                            style="width: 80px;height:25px;">
                            选择对象组..</button>
               <button id="btnMODEL" name="mqo"   class="btnCheck" type="button"
                            style="width: 80px; margin-left:20px;height:25px;">
                            选择模板</button>
                            </td>
            </tr>
            <tr>
                <td>接收人员：</td>
                <td ><input type="hidden" id="PM" runat="server" />
                     <textarea id="txtPM" name="receave" rows="3"  readonly="readonly"  runat="server"
                        style="width:480px; background-color:Silver"></textarea>
                </td>
            </tr>
            <tr>
                <td>消息内容：<span style="color: Red">*</span></td>
                <td ><input type="hidden" id="MODEL" runat="server" />
                    <textarea id="txtMODEL" name="receave" rows="10"  runat="server" onKeyUp="chechezishunum(this);"
                        style="width:480px;"></textarea><br />
                        <asp:Label CssClass="labmessage" ID="labnums" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td width="100">发送方式：</td>
                <td>
                    <asp:DropDownList ID="ddlSendmode" runat="server"  Enabled="false" Width="160">
                        <asp:ListItem Value="0">短信</asp:ListItem>
                        <asp:ListItem Value="1">彩信</asp:ListItem>
                    </asp:DropDownList>
               <%-- 定时--%>
                <input runat="server" type="text" id="PlanTime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"  style="width:100px; display:none;" />
                    <asp:HiddenField ID="hdfuserid" runat="server" />
                   <asp:Button ID="btnsend" runat="server" Text="发送" class="btnCheck" OnClientClick="return checkmes();" OnClick="btnsendOnClick"
                            style="width: 80px;height:25px;" />
                </td>
            </tr>
            <tr><td colspan="2"><asp:Label CssClass="labmessage" ID="Labmes" runat="server" Text=""></asp:Label></td></tr>
         <tr><td >
         操作说明：
         </td><td >
         1、总体操作分为：选择接收人、书写短信内容、根据情况判定是否需要定时发送，点击发送；<br />
         （即时发送不需要选择定时时间，定时时间小于当前时间时，按即时发送处理，其他按选择的时间发送）<br />
         2、关于选择接收人，目前提供4种方式：组织架构--针对公司内容在职员工，可按部门选择；<br />
            客户--针对中旭外部的客户，分公海、私海客户；群组--针对自建的接收人组合，选择的是整个组的人员；<br />
            群组成员--不分群组，从成员表中直接选取；<br />
         3、在选择完接收人之后，填写消息之前，可根据实际情况，对日常用语、自定义短信可选用模板，<br />
            模板的格式可自行定义，自定义格式为:{姓}、{名}、{昵称}、{生日}、{手机号}、{公司}、{职位}；<br />
            注意：只有选择对象为【群组】时，才可以使用上述所有格式，其他只能使用一个格式即：{姓}；<br />
         4、点击“发送”后，按钮将消失；当提示“发送失败”后，该短信已保存在数据库当中，系统将定时重新发送，无需人工再次发送；
         </td>
         </tr>
         </table>
   <div id="dialog1" class="yui-pe-content">
            <div class="hd">
                信息选择</div>
            <div class="bd">
                <iframe id="EditUIWindow1" frameborder="0" src="" style="width: 100%; height: 100%;
                    margin: 0px; padding: 0px;"></iframe>
            </div>
   </div>
    </form>
</body>
<script language="javascript" type="text/javascript" src="../Scripts/DatePicker/WdatePicker.js"></script>
<script  language="javascript" type="text/javascript">
    var addUser = '<% =UserId %>';
    function checkmes()
    {
        var btn = document.getElementById("btnsend");
        var user = document.getElementById("txtPM");
        var mess = document.getElementById("txtMODEL");
        if (user.value == null || user.value == "")
        {
            alert("请选择发送对象");
            return false;
        }
        if (mess.value == null || mess.value == "")
        {
            alert("请填写消息内容");
            mess.focus();
            return false;
        }
        else if (mess.value.length> 300)
        {
            alert("请将短信限制在300字符以内，谢谢！");
            mess.focus();
            return false;
        }
        btn.style.display = "none";
        return true;
    }
    //选择对应的方法和ID
    var _fn, _id;
    function ShowDialog1(fn, id, src)
    {
        _fn = fn;
        _id = id;
        document.getElementById("EditUIWindow1").src = src;
        YAHOO.example.container.dialog1.show();
    }
    YAHOO.namespace("example.container");
    YAHOO.util.Event.onDOMReady(function ()
    {
        var handleSubmit = function ()
        {
            var editwindow = document.getElementById("EditUIWindow1");
            if (editwindow)
            {
                editwindow.contentWindow.ChooseInfo();
            }
            YAHOO.example.container.dialog1.hide();
        };
        var handleCancel = function ()
        {
            this.cancel();
        };
        var handleSuccess = function (o)
        {
            var response = o.responseText;
            response = response.split("<!")[0];
            document.getElementById("resp").innerHTML = response;
        };
        var handleFailure = function (o)
        {
            alert("Submission failed: " + o.status);
        };
        YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
					            { width: "580px",
					                height: "450px",
					                fixedcenter: true,
					                visible: false,
					                draggable: true,
					                close: true,
					                autofillheight: "body",
					                constraintoviewport: true,
					                buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
								            { text: "取消", handler: handleCancel}]
					            });
        YAHOO.example.container.dialog1.callback = { success: handleSuccess, failure: handleFailure };
        YAHOO.example.container.dialog1.render();
    });


    function chechezishunum(obj) { //labnums
        var num = obj.value.length;
        var tiao=0;
        if (num < 71)
            tiao = 1;
        else if (num < 141)
            tiao = 2;
        else if (num < 211)
            tiao = 3;
        else if (num < 281)
            tiao = 4;
        else if (num < 301)
            tiao = 5;
        else {
            alert("请将短信限制在300字符以内，谢谢！");
            tiao = 5;
            obj.value = obj.value.substring(0, 300);
        }
        document.getElementById("labnums").innerHTML = "已输入：" + obj.value.length + " 个字，按短信条数计算为：" + tiao + "条，最大输入字数为300个";
    }
</script>
</html>
